/*
 * Copyright (c) 2011 Ayan Dave http://www.linkedin.com/in/daveayan
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 
 * associated documentation files (the "Software"), to deal in the Software without restriction, including 
 * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
 * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 
 * following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all copies or substantial 
 * portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
package testrj.sample;

import testrj.runner.TestRunner;
import testrj.sample.controller.SomeComplexController;
import testrj.sample.domain.Account;
import testrj.sample.domain.Address;
import testrj.sample.domain.Person;
import testrj.sample.domain.PhoneNumber;

public class Driver {
	public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException {
		testGeneration();
		// testRunning();
	}

	public static void testRunning() {
		TestRunner runner = TestRunner
				.instantiateRunnerFor("testrj.sample.controller.SomeComplexController_someComplexMethod-_testrj.sample.domain.Person_testrj.sample.domain.Account");
		runner.runTestCase();
	}

	public static void testGeneration() {
		Account a1 = new Account(123, 100);
		Account a2 = new Account(456, 200);
		Address add1 = new Address("tuttles creek", "OH", "Dublin", "43016");
		Address add2 = new Address("sawmill village dr", "OH", "Columbus", "43235");
		PhoneNumber ph1 = new PhoneNumber("443", "3233323");
		PhoneNumber ph2 = new PhoneNumber("657", "9466354");

		Person p1 = new Person();
		p1.setName("QWERTY");
		p1.addAccount(a1);
		p1.addPhone(ph1);
		p1.addPhone(ph2);
		p1.addAddress("Home", add1);
		p1.addAddress("Office", add2);

		SomeComplexController c = new SomeComplexController();
		System.out.println("someComplexMethod");
		/* Person p2 = */c.someComplexMethod(p1, a2);

		 System.out.println("add");
		 c.add(4, 5);
		
		 System.out.println("save");
		 c.save(p1);
		
		 System.out.println("add");
		 c.add(9, a1);
		
		 System.out.println("getMessage");
		 c.getMessage();
		
		 System.out.println("getMessage(Ayan)");
		 c.getMessage("Ayan");
		
		 System.out.println("getMessage(World)");
		 c.getMessage("World");
	}
}